import { Button, Modal } from "antd-mobile";
import { navigateTo } from "@/utils";
import requewt from "@/utils/requewt";
import { API } from "@/config";
import callFeedback from "@/components/common/modalFeedback";
import { useState } from "react";


export default function ({result}) {
  const RESULTS = {
    1: {
      key: 1,
      title: `恭喜您`,
      thumb: `https://yinli-qixi-run.varwey.com/2023/3w-jump-alien-230703/img/prize/prize-1.png`,
      des: data => <>
        上周U电值排名第{data?.rank || `999+`} <br />
        获得{data?.reward_name || `0U币奖励`}
      </>,
      info: `（U币将于本周三前发放至您的账户）`,
      actions: handler => [
        <Button shape={`rounded`}
                className="act-btn act-btn-bevel"
                onClick={e => Modal.clear()}
        >
          确定
        </Button>,
      ]
    },
    0: {
      key: 0,
      title: `很遗憾`,
      thumb: `https://yinli-qixi-run.varwey.com/2023/3w-jump-alien-230703/img/prize/prize-2.png`,
      des: data => <>
        上周您未上榜<br />
        本周再接再厉吧
      </>,
      info: <>
        可点击盲盒领取参与奖<br />
        （U币将于本周三前发放至您的账户）
      </>,
      actions: handler => [
        <Button shape={`rounded`}
                className="act-btn act-btn-bevel"
                onClick={e => Modal.clear()}
        >
          确定
        </Button>,
        <Button shape={`rounded`}
                className="act-btn act-btn-bevel"
                onClick={e => navigateTo(`/lottery`)}
        >
          去抽奖
        </Button>,
      ]
    },
    2: {
      key: 2,
      title: `很遗憾`,
      thumb: `https://yinli-qixi-run.varwey.com/2023/3w-jump-alien-230703/img/prize/prize-2.png`,
      des: data => <>
        上周您未上榜<br />
        本周再接再厉吧<br />
        限时盲盒奖励已过期
      </>,
      actions: handler => [
        <Button shape={`rounded`}
                className="act-btn act-btn-bevel"
                onClick={e => Modal.clear()}
        >
          确定
        </Button>,
      ]
    }
  }

  const status = result?.status;
  const resultObj = RESULTS[status];

  return (
    <>
      <div className="title">
        {resultObj?.title}
      </div>

      <div className="prize">
        <img src={resultObj?.thumb} alt="" />
      </div>
      <div className="desc">
        {resultObj?.des(result)}
      </div>

      <div className="info">
        {resultObj?.info}
      </div>

      {/*<div className="operation">*/}
      {/*  {resultObj?.actions?.()}*/}
      {/*</div>*/}
    </>
  )
}